﻿@section Script
{
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Content/validBox/validBox.js"></script> 
    <link href="~/Content/validBox/images/validBox.css" rel="stylesheet" />
    <link href="~/Content/window/window.css" rel="stylesheet" />
    <script src="~/Content/window/window.js"></script>
    <style type="text/css">
        form {
            margin-top: 120px;
        }

        .form-horizontal .control-label {
            width: 60px;
        }

        .form-horizontal .controls {
            margin-left: 80px;
        }

        button {
            width: 130px;
        }

        .link {
            margin-left: 15px;
        }
    </style>
}

<script type="text/javascript">
    function changePassword() {
        $('form').validBox(function (r) {
            if (r == false) return;
            $.post("/system/changepassword", $('form').serialize(), function (data) {
                if (data.state == false) {
                    messageBox('提示', data.value);
                } else {
                    messageBox('提示', '修改密码成功！');
                    setTimeout(function () { location.href = "/home"; }, 2000);
                }
            });
        });
    }
</script>

<div class="mainbodywrap">
    <div class="mainbody">
        <div class="bluetitle">
            <div class="left"></div>
            <div class="right"></div>
            <div class="title">修改密码</div>
        </div>
        <div class="contentwrap">
            <div class="left">
                <img alt="" src="/images/lock.png" width="366" height="343" />
            </div>
            <div class="right">
                <form class="form-horizontal">
                    <div class="control-group">
                        <label class="control-label" for="OldPassword">原始密码</label>
                        <div class="controls">
                            <input type="password" id="OldPassword" name="OldPassword" value="" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="NewPassword">新密码</label>
                        <div class="controls">
                            @Html.Password("NewPassword", null, Html.Valid().Required().MinLength(6).AsHtmlAttribute())
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="RePassword">确认密码</label>
                        <div class="controls">
                            @Html.Password("RePassword", null, Html.Valid().Required().EqualTo("NewPassword").AsHtmlAttribute())
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls">
                            <button onclick="changePassword();return false" class="btn btn-info">确认</button>
                        </div>
                    </div>
                </form>
            </div>
            <br class="spacer" />
        </div>
    </div>
</div>
